package com.example.hello.mapstruct.convertor;

import com.example.hello.mapstruct.pojo.Boy;
import com.example.hello.mapstruct.pojo.Man;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.Named;

@Mapper(componentModel = "spring")
public interface ObjectConvertor {


    @Mapping(source = "blogName", target = "blog")
    @Mapping(source = "blogName", target = "blogUrl", qualifiedByName = "blogUrl")
    Man boy2Man(Boy boy);

    @Named("blogUrl")
    default String blogUrl(String blog){
        return "https://"+blog;
    }
}
